﻿#include "CSerialPortBase.h"

CSerialPortBase::CSerialPortBase()
{
    lastError = 0;
    m_minByteReadNotify = 1;
    m_operateMode =  AsynchronousOperate;

    m_setting.baudRate= BaudRate9600;
    m_setting.parity= ParityNone;
    m_setting.dataBits= DataBits8;
    m_setting.stopBits= StopOne;
    m_setting.flowControl= FlowNone;
    m_setting.readBufferSize=512;
}

//const std::string & portName
CSerialPortBase::CSerialPortBase(const CSerialPortSettings & setting)
{

    lastError = 0;
    m_minByteReadNotify = 1;
    m_operateMode =  AsynchronousOperate;

    m_setting=setting;

}

CSerialPortBase::~CSerialPortBase() {}

void CSerialPortBase::setOperateMode( OperateMode operateMode)
{
    m_operateMode = operateMode;
}

unsigned int CSerialPortBase::getMinByteReadNotify()
{
    return m_minByteReadNotify;
}

int CSerialPortBase::getLastError() const
{
    return lastError;
}

void CSerialPortBase::clearError() {}
